<?php
class SysLogModel extends CommonModel {
    
    /**
     * Add
     * 
     * @param  $strMethod
     * @param  $strParams
     * @param  $strDescription
     * @param  $strRemark
     * @param  $strUrl
     * @param  $intUserId
     * @param  $strUserName
     * @return void
     * @author andy
     */
    public function add( $strMethod, 
                         $strParams = '',
                         $strDescription = '',
                         $strRemark = '',
                         $strUrl = '', 
                         $intUserId = '', 
                         $strUserName = '' ) {
        
        $int_user_id               = $intUserId ? $intUserId : get_login_user_id();
        $str_user_name             = $strUserName ? $strUserName : get_login_user_name();
        $str_url                   = $strUrl ? $strUrl : get_current_url();

        $obj_sys_log               = D('sys_log');
        $obj_sys_log->user_id      = intval($int_user_id);
        $obj_sys_log->user_name    = $str_user_name;
        $obj_sys_log->method       = $strMethod;
        $obj_sys_log->url          = $str_url;
        $obj_sys_log->params       = $strParams;
        $obj_sys_log->description  = $strDescription;
        $obj_sys_log->remark       = $strRemark;
        $obj_sys_log->client_ip    = get_client_ip();
        $obj_sys_log->create_time  = get_date();
        $obj_sys_log->update_time  = get_date();
        
        return $obj_sys_log->add();
    }
}